<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>参数传递</title>

</head>
<body>
<script src="vue.global.js"></script>
<div id="app">
    <h1>自动售卖机</h1>
    <button @click="buy(5)">苹果</button>
    <button @click="buy(10)">饮料</button>
    <p>余额为：{{money}}元</p>
</div>
<script>
const app = Vue.createApp({
    data(){
        return{
           money:100
        }
    },
    methods:{
        buy(price){
            this.money-=price
        }
    }
}).mount('#app')
</script>
</body>
</html>
